package com.woniuxy.rabbitMQ;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.woniuxy.service.OrdersService;

/**
 * 取消订单消息的处理者
 */
@Component
@RabbitListener(queues = "auction.order.cancel")
public class CancelOrderReceiver {
	private static Logger LOGGER = LoggerFactory.getLogger(CancelOrderReceiver.class);
	@Autowired
	private OrdersService ordersService;

	@RabbitHandler
	public void handle(String order_no) {
		LOGGER.info("receive delay message orderId:{}", order_no);
		ordersService.updataStatus(order_no, 10); // 未支付，流拍
	}
}
